package org.xxx.epms.monitor.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.xxx.epms.monitor.mapper.MonitorMapper;
import org.xxx.epms.monitor.model.Monitor;
import org.xxx.epms.monitor.service.MonitorService;

@Service
public class MonitorServiceImpl implements MonitorService {

    @Autowired
    private MonitorMapper monitorMapper;

    @Override
    public String getMonitorInfo(String monId) {
//        throw new RuntimeException("testException");
        return "monitorInfo";
    }

    @Override
    public Monitor getMonitorByMonId(int monId) {
        QueryWrapper<Monitor> queryWrapper = new QueryWrapper<Monitor>();
        queryWrapper.eq("mon_id", monId);
        return monitorMapper.selectOne(queryWrapper);
    }

    @Override
    public Monitor getMonitorByMonTel(String monTel) {
        QueryWrapper<Monitor> queryWrapper = new QueryWrapper<Monitor>();
        queryWrapper.eq("mon_tel", monTel);
        return monitorMapper.selectOne(queryWrapper);
    }
}
